package com.treehouse.northlight.component;

import com.artemis.Component;

/**
 * Component Class
 * 
 * Used for Double attributed components like stats.
 * 
 * @author Julian Biermann
 * @version 1.0 	03.03.2013
 * 
 */
public class DoubleAttribute extends Component {

	private String attributeName;
	private double value;

	/**
	 * Set the attribute name and initialize the value with 0.
	 * 
	 * @param attributeName
	 *            Name of the attribute
	 */
	public DoubleAttribute(String attributeName) {
		this.attributeName = attributeName;
		this.value = 0;
	}

	/**
	 * Sets the attribute name and value.
	 * 
	 * @param attributeName
	 *            Name of the attribute
	 * @param value
	 *            Value of the attribute
	 */
	public DoubleAttribute(String attributeName, double value) {
		this(attributeName);
		this.value = value;
	}

	/**
	 * @return attributeName as String
	 */
	public String getAttributeName() {
		return attributeName;
	}

	/**
	 * @param attributeName
	 *            the attributeName to set
	 */
	public void setAttributeName(String attributeName) {
		this.attributeName = attributeName;
	}

	/**
	 * @return value as double
	 */
	public double getValue() {
		return value;
	}

	/**
	 * @param value
	 *            the value to set
	 */
	public void setValue(double value) {
		this.value = value;
	}

	/**
	 * Adds a given value to the stored value.
	 * 
	 * @param amount
	 *            Value to be added.
	 */
	public void addToValue(double amount) {
		this.value += amount;
	}

}
